unit USistema;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, UFomCadastro, StdCtrls, Buttons, ExtCtrls, DB, DBTables, RxCalc,
  ToolEdit, Mask, DBCtrls, Provider, SqlExpr, DBClient, DBLocal, DBLocalS;

type
  TFCadastroSistema = class(TFormCadastro)
    DEBackup: TDirectoryEdit;
    DEBase: TDirectoryEdit;
    FENomeBase: TFilenameEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    DBCBImagemVisivel: TDBCheckBox;
    FEDirImagem: TFilenameEdit;
    Label5: TLabel;
    DEDirExecutavel: TDirectoryEdit;
    procedure BtnExcluirClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure BtnSalvarClick(Sender: TObject);
    procedure BtnEditarClick(Sender: TObject);
    procedure BtnCancelarClick(Sender: TObject);
    procedure SQLCadastroBeforePost(DataSet: TDataSet);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FCadastroSistema: TFCadastroSistema;

implementation

uses UDMGeral, UGeral;


{$R *.dfm}

procedure TFCadastroSistema.BtnExcluirClick(Sender: TObject);
begin
 try
  if MessageDlg('Deseja realmente excluir este registro ? ',mtWarning,mbOKCancel,0) = 2 then
   exit;
  inherited;
 except
 end; 
end;

procedure TFCadastroSistema.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
 FCadastroSistema:=nil;
 inherited;
end;

procedure TFCadastroSistema.FormCreate(Sender: TObject);
begin
  inherited;
  ConectaSqlDBConnection(self,DMGeral.SQLConnection);
  DEDirExecutavel.Text:=SQLCadastro.fieldByname('SIS_DIREXE').AsString;
  DEBackup.Text:=SQLCadastro.fieldByname('SIS_DIRBACKUP').AsString;
  DEBase.Text:=SQLCadastro.fieldByname('SIS_DIRBASE').AsString;
  FENomeBase.Text:=SQLCadastro.fieldByname('SIS_NOMEBASE').AsString;
  FENomeBase.InitialDir:=SQLCadastro.fieldByname('SIS_DIRBASE').AsString;
  FEDirImagem.Text:=SQLCadastro.fieldByname('SIS_DIRImagem').AsString;
end;

procedure TFCadastroSistema.BtnSalvarClick(Sender: TObject);
begin
 try
  SQLCadastro.fieldByname('SIS_DIREXE').AsString:=DEDirExecutavel.Text;
  SQLCadastro.fieldByname('SIS_DIRBACKUP').AsString:=DEBackup.Text;
  SQLCadastro.fieldByname('SIS_DIRBASE').AsString:=DEBase.Text;
  SQLCadastro.fieldByname('SIS_NOMEBASE').AsString:=FENomeBase.Text;
  SQLCadastro.fieldByname('SIS_DIRImagem').AsString:=FEDirImagem.Text;
  inherited;
 except
 end; 
end;

procedure TFCadastroSistema.BtnEditarClick(Sender: TObject);
begin
 try
  inherited;
 except
 end;

end;

procedure TFCadastroSistema.BtnCancelarClick(Sender: TObject);
begin
 try
  inherited;
 except
 end;

end;

procedure TFCadastroSistema.SQLCadastroBeforePost(DataSet: TDataSet);
begin
// inherited;

end;

end.
